import request from '@/utils/request'

/**
 * 员工登录
 */
export function login(data) {
  return request({
    url: '/employee/login',
    method: 'post',
    data
  })
}

/**
 * 员工登出
 */
export function logout() {
  return request({
    url: '/employee/logout',
    method: 'post'
  })
}

/**
 * 获取当前登录员工信息
 */
export function getCurrentEmployee() {
  return request({
    url: '/employee/current',
    method: 'get'
  })
}

/**
 * 分页查询员工
 */
export function getEmployeePage(params) {
  return request({
    url: '/employee/page',
    method: 'get',
    params
  })
}

/**
 * 新增员工
 */
export function addEmployee(data) {
  return request({
    url: '/employee',
    method: 'post',
    data
  })
}

/**
 * 更新员工
 */
export function updateEmployee(data) {
  return request({
    url: '/employee',
    method: 'put',
    data
  })
}

/**
 * 删除员工
 */
export function deleteEmployee(id) {
  return request({
    url: `/employee/${id}`,
    method: 'delete'
  })
}

/**
 * 修改密码
 */
export function changePassword(data) {
  return request({
    url: '/employee/changePassword',
    method: 'post',
    data
  })
}

